package com.bgs.contorller;


//import com.bgs.config.DirectConfig;
import com.bgs.config.DirectConfig;
import com.bgs.pojo.Approve;
import com.bgs.service.appService;
import com.bgs.tool.R;
import com.bgs.vo.ApproveVo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/approve")
public class Ccontorller {


    @Autowired
    private RabbitTemplate templateRaliable;

    @Autowired
    private appService appService;


//  添加入职审批
    @PostMapping("/addrz")
    public R insertaddrz(@RequestBody ApproveVo approve){
        templateRaliable.convertAndSend(DirectConfig.DIRECT_MSY_EXCHANGE_NAME,DirectConfig.DIRECT_MSY_ROUTING_KEY_NAME,approve);
        return appService.insertaddrz(approve);
    }

//    查询我发起的审批
    @GetMapping("/mineemp")
    public R selectmineemp(Integer eid){
        return appService.selectmineemp(eid);
    }

    @PostMapping("/selectapr")
    public R selectapr(Integer eid){
        return appService.selectapr(eid);
//        System.out.println(appService.selectapr(eid));
    }
    @GetMapping("/selectById")
    public R selectById(Integer id){
        return appService.selectById(id);
    }

    @PostMapping("/updatesp")
    public Boolean updatesp(Integer id,Integer spid){
        return appService.updatesp(id,spid);
    }
    @PostMapping("/selectcc")
    public R selectcc(Integer eid){
        return  appService.selectcc(eid);
    }
}
